<template>
	<view class="container">
		<cu-custom bgColor="bg-top" :isBack="true">
			<block slot="content">设备列表</block>
		</cu-custom>
		<view class="address-list">
			<view class="a-address" v-for="(item,index) in equipList" :key="index">
				<navigator :url="'/pages/ucenter/siteSet/equipment/poll/poll-list?siteID=' + pageInfo.siteID +'&equipmentID=' + item.equipmentId" class="left-text">
					<view class="name-tel">
						{{item.equipmentName}} 
					</view>
					<view class="address-box">
						{{item.factoryName}}
					</view>
				</navigator>
				<navigator :url="'/pages/ucenter/siteSet/equipment/equipInfo?id=' + item.guid +'&equipmentName=' + item.equipmentName" class="right-edit"></navigator>
			</view>
		</view>
		<!-- <view class="bottom-box">
			<view class="add-btn" @tap="addAddess">新增设备</view>
		</view> -->

	</view>
</template>

<script>
	import Util from '@/utils/util.js';
	export default {
		data() {
			return {
				equipList: [],
				pageInfo:{
					page:1,
					limit:20,
					siteID:''
				}
			}
		},
		onLoad(e) {
			//根据站点id加载设备数据
			if(e.id){
				this.pageInfo.siteID = e.id
				//查询设备
				Util.request('/monitor/siteEquipment/list', this.pageInfo, 'GET').then(res=>{
					this.equipList=res.data; //任务单数据
				}).catch(()=>{
					//联网失败, 结束加载
				})
			}
		},
		methods: {
			addAddess() {
				console.log("tap add new Address");
			}
		}
	}
</script>

<style>
	.container {
		background-color: #F2f2f2;
	}

	.address-list {
		width: 100%;
		background-color: #fff;
		margin-top: 20upx;
		padding-bottom: 100upx;
	}

	.address-list .a-address {
		width: 720upx;
		margin-left: 30upx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 30upx 0;
		border-bottom: 1upx solid #eee;
	}

	.a-address .left-text {
		width: 610upx;
		box-sizing: border-box;
		padding-left: 58upx;
	}

	.a-address .left-text.active {
		background: url() no-repeat left center;
		background-size: 28upx auto;
	}

	.a-address .left-text .name-tel {
		margin-bottom: 20upx;
	}

	.a-address .left-text .address-box {
		font-size: 24upx;
		color: #888888;
		line-height: 36upx;
	}

	.a-address .right-edit {
		width: 109upx;
		height: 100%;
		padding: 50upx 0 50upx 58upx;
		box-sizing: border-box;
		background: url() no-repeat 43upx center;
		background-size: 35upx auto;
	}
	
	.bottom-box {
		position: fixed;
		width: 100%;
		bottom: 0;
		font-size: 28upx;
		color: #000000;
		border-top: 1upx solid #eee;
		height: 100upx;
		line-height: 100upx;
		background: #fff url() no-repeat 705upx center;
		background-size: 15upx auto;
	}

	.bottom-box .add-btn {
		margin-left: 30upx;
		padding-left: 70upx;
		background: url() no-repeat left center;
		background-size: 40upx auto;
	}
</style>
